package com.ysj.demo.accompanynetwork.service;

import com.google.gson.Gson;
import com.ysj.demo.accompanynetwork.bean.RestRsp;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;

public class ResultCallback implements Callback<RestRsp> {

    private RestRsp m;

    public ResultCallback(RestRsp m) {
        this.m = m;
    }

    @Override
    public void onResponse(Call<RestRsp> call, Response<RestRsp> response) {
        RestRsp restRsp = response.body();
        System.out.println(new Gson().toJson(restRsp));
        m = restRsp;
    }

    @Override
    public void onFailure(Call<RestRsp> call, Throwable t) {

    }

//    @Override
//    public void onResponse(Call<RestRsp<M>> call, Response<RestRsp<M>> response) {
//        RestRsp restRsp = response.body();
//        System.out.println(new Gson().toJson(restRsp));
//        m = restRsp;
//
//    }
//
//    @Override
//    public void onFailure(Call<RestRsp<M>> call, Throwable t) {
//
//    }


//    private T result;
//    private String msg;
//
//    public ResultCallback(T result) {
//        this.result = result;
//    }
//
//    public ResultCallback(T result, String msg) {
//        this.result = result;
//        this.msg = msg;
//    }
//
//    @Override
//    public void onResponse(Call<T> call, Response<T> response) {
//        result = response.body();
//        System.out.println("receive success");
//       // Log.i("callback",result.toString());
//    }
//
//    @Override
//    public void onFailure(Call<T> call, Throwable t) {
//        Log.e("error",t.getMessage(),t);
//        result = null;
//    }
}
